﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace LogFileScanner
{
    public class Utility
    {
        public enum MessageLevel
        {
            INFO,
            WARN,
            ERROR
        }

        public delegate void VoidMethodDelegate();
        public delegate void MessageMethodDelegate(string value, MessageLevel level);

        public static string FormatFileSize(long len)
        {
            string[] sizes = { "B", "KB", "MB", "GB" };
            int order = 0;
            while (len >= 1024 && order + 1 < sizes.Length)
            {
                order++;
                len = len / 1024;
            }
            string result = String.Format("{0:0.##} {1}", len, sizes[order]);

            return result;
        }

    }
}
